package set_;
import java.util.HashSet;
import java.util.Set;
@SuppressWarnings({"all"})

public class HashSet_ {
    public static void main(String[] args) {
        Set set =  new HashSet();
        set.add("jack");
        System.out.println(set);
        set.add(new Dog("小黑"));
        set.add(new Dog("小黑"));
        System.out.println(set);
        set.clear();
        System.out.println(set);
        set.add(new String("ya民"));
        set.add(new String("ya民"));//加入不了了，源码
        System.out.println("set" + set);

    }
}

class Dog{
    private String name;

    public Dog(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Dog{" +
                "name='" + name + '\'' +
                '}';
    }
}